Skip to content

Conversation

@ozsay
Copy link
Contributor

@ozsay ozsay commented Feb 10, 2026

Note

Description

Adds a new base44 logs command that fetches and displays runtime logs from deployed functions. Users can filter by function name, time range, log level, and control output format. Logs are displayed in a plain log-file format suitable for piping to other tools.

Related Issue

None

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Other (please describe):

Changes Made

  • Added getLogsCommand() factory in src/cli/commands/logs/index.ts with filtering options (function, since, until, level, limit, order, json)
  • Implemented fetchFunctionLogs() API client in src/core/resources/function/api.ts to retrieve logs from Deno Deploy via /functions-mgmt/{functionName}/logs endpoint
  • Added FunctionNotFoundError to core errors for clear function-not-found handling with hints listing available functions
  • Added FunctionLogsResponse and related Zod schemas to src/core/resources/function/schema.ts for log entry validation
  • Extended runCommand() utility with skipIntro and skipOutro options to support pipe-friendly output (no @clack/prompts UI elements)
  • Registered logs command in CLI program
  • Added comprehensive test coverage in tests/cli/logs.spec.ts (11 test cases covering success, filters, errors, edge cases)
  • Extended Base44APIMock test utility with mockFunctionLogs() and mockFunctionLogsError() helpers

Testing

  • I have tested these changes locally
  • I have added/updated tests as needed
  • All tests pass (npm test)

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • I have updated AGENTS.md if I made architectural changes

Additional Notes

The command supports both interactive use (base44 logs --function my-fn) and piping to other tools (base44 logs --json | jq). When no --function is specified, it fetches logs for all functions defined in the project. The skipIntro/skipOutro options ensure clean output for pipe-friendly commands by bypassing @clack/prompts UI elements.


🤖 Generated by Claude | 2026-02-10 02:15 UTC

@github-actions
Copy link
Contributor

github-actions bot commented Feb 10, 2026

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/cli@0.0.30-pr.225.09b17d9

Prefer not to change any import paths? Install using npm alias so your code still imports base44:

npm i "base44@npm:@base44-preview/cli@0.0.30-pr.225.09b17d9"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/cli@0.0.30-pr.225.09b17d9"
  }
}

Preview published to npm registry — try new features instantly!

@claude
Copy link

claude bot commented Feb 10, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@claude
Copy link

claude bot commented Feb 10, 2026

Found 2 issues:

  1. FunctionNotFoundError should be in errors.ts per CLAUDE.md
  2. normalizeDatetime regex needs anchor on Z

See full details in review comment.

@claude
Copy link

claude bot commented Feb 10, 2026

Code Review - Detailed Findings

Issue 1: FunctionNotFoundError location violates CLAUDE.md

File: src/core/resources/function/api.ts (lines 11-38)

Problem: The PR defines FunctionNotFoundError in src/core/resources/function/api.ts, but CLAUDE.md requires all error classes to be in src/core/errors.ts.

References:

  • Line 479: "Import errors from @/core/errors.js"
  • Rule fix folders issues #15 (line 659): "use specific error classes from @/core/errors.js"

See: https://github.com/base44/cli/blob/4f5dea819eb329ccb12bab118fedb262623aae0b/CLAUDE.md#L479

Solution: Move FunctionNotFoundError to src/core/errors.ts and import it from @/core/errors.js


Issue 2: Regex bug in normalizeDatetime

File: src/cli/commands/logs/index.ts (lines 88-91)

Problem: The regex /Z|[+-]\d{2}:\d{2}$/ matches Z anywhere (not just at end) due to alternation precedence.

Current: if (/Z|[+-]\d{2}:\d{2}$/.test(value))

Fixed: if (/Z$|[+-]\d{2}:\d{2}$/.test(value))

Impact: Minimal in practice, but technically incorrect.


Otherwise excellent work! Well-structured implementation with comprehensive tests.

…alizeDatetime

- Move FunctionNotFoundError class to core/errors.ts per project conventions
- Fix regex alternation bug: anchor Z to end-of-string in normalizeDatetime

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant